﻿/********************************************************************************
 * Developed by Phil Tyler (http://www.laidbackcoder.co.uk)
 * 
 * Cryptosolic is Licensed under the GNU Lesser General Public License (LGPL)
 * http://cryptosolic.codeplex.com/license
 * *****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cryptosolic.Security.HMAC
{
	/// <summary>
	/// 
	/// </summary>
    internal class HMACAlgorithm : IHMACAlgorithm
    {
    	/// <summary>
    	/// 
    	/// </summary>
    	/// <param name="data"></param>
    	/// <param name="key"></param>
    	/// <returns></returns>
        public CipherText HashData(string data, string key)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="key"></param>
        /// <param name="iterations"></param>
        /// <returns></returns>
        public CipherText HashData(string data, string key, int iterations)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public CipherText HashData(byte[] data, byte[] key)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="key"></param>
        /// <param name="iterations"></param>
        /// <returns></returns>
        public CipherText HashData(byte[] data, byte[] key, int iterations)
        {
            throw new NotImplementedException();
        }

         /// <summary>
        /// Hash a Human Readable Byte Array
        /// </summary>
        /// <param name="data">Data to be Hashed</param>
        /// <param name="hashProvider">Hashing Algorithm used to compute the Hash</param>
        /// <param name="key">Key used to Compute Hash</param>
        /// <returns>Hashed Data</returns>
        internal CipherText PerformHMACOperation(byte[] data, System.Security.Cryptography.HMAC hashProvider, byte[] key)
        {
            hashProvider.Key = key;
            byte[] hash = hashProvider.ComputeHash(data);
            hashProvider.Clear();

            return new CipherText(hash);
        }
    }
}
